package com.halflife.concurrence;

import sun.nio.ch.Interruptible;

public class InterruptTest {
    public static int count = 1;
    public static void main(String[] args)throws Exception {
        Thread thread1 = new Thread(new Runnable() {
            public void run() {
                while (true) {
                    count++;
                    System.out.println("111");
                    if (count == 4) {
                        Thread.currentThread().interrupt();
                    }else{
                        try {
                            Thread.currentThread().sleep(1000);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                    }

                }

            }
        }, "Thead1");
        thread1.start();
//        sun.misc.SharedSecrets.getJavaLangAccess().blockedOn(thread1, new Interruptible() {
//            public void interrupt(Thread thread) {
//                System.out.println("you are interrupted");
//            }
//        });
    }



}
